/****************************************************************************\
*                                                                            *
*  Copyright 2008 The CAnt2 Project (http://code.google.com/p/cant2)         *
*                                                                            *
*  Licensed under the Apache License, Version 2.0 (the "License");           *
*  you may not use this file except in compliance with the License.          *
*  You may obtain a copy of the License at                                   *
*                                                                            *
*      http://www.apache.org/licenses/LICENSE-2.0                            *
*                                                                            *
*  Unless required by applicable law or agreed to in writing, software       *
*  distributed under the License is distributed on an "AS IS" BASIS,         *
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  *
*  See the License for the specific language governing permissions and       *
*  limitations under the License.                                            *
*                                                                            *
\****************************************************************************/

#ifndef INCLUDED_XML_H__
#define INCLUDED_XML_H__

#include <iosfwd>
#include <memory>

class IXmlParseEvent
{
public:
    virtual void ElementBegin ( const wchar_t* name ) = 0;
    virtual void ElementEnd   ( const wchar_t* name ) = 0;
    virtual void Attribute    ( const wchar_t* name, const wchar_t* value ) = 0;
    virtual void ElementEndAttributes ( const wchar_t* name ) = 0;
    virtual void EndOfFile    () = 0;

protected:
    ~IXmlParseEvent();
};

class XmlParser
{
public:
    XmlParser ( std::istream& is, IXmlParseEvent& xpe );
    ~XmlParser ();
    void Run();

private:
    XmlParser ( const XmlParser& );
    XmlParser& operator = ( const XmlParser& );

private:
    class Details;
    std::auto_ptr < Details > pimpl;
};

#endif /* #ifndef INCLUDED_XML_H__ */

